Strict

Import agfx

Global myTitleScreen:TTitleScreen
Global myGameScreen:TGameScreen

Const GRAVITY:Float = 0.06


Class TAgfx_test_app Extends TFramework
	

	Method OnCreate:Int()
	
		Super.OnCreate()
		
		DISPLAY.SetVirtualSize(800, 600)
		
		IMAGES.Load("spark.png")
		
		myTitleScreen = New TTitleScreen
		myGameScreen = New TGameScreen
		myTitleScreen.Prepare()
		
		Return 0
	End Method
		
End





Class TTitleScreen Extends TScreen

	Method New()
		name = "Title"
	End
	
	Method Start:Void()
		APP.fadeScreen.Start(50, False)
	End Method
	
	Method Render:Void()
		Cls
		DrawText "TITLE SCREEN!", DISPLAY.VSCREEN_HALF_WIDTH, DISPLAY.VSCREEN_HALF_HEIGHT, 0.5, 0.5
		DrawText "Click to Play!", DISPLAY.VSCREEN_HALF_WIDTH, DISPLAY.VSCREEN_HALF_HEIGHT + 20, 0.5, 0.5
		DrawText "Escape to Quit!", DISPLAY.VSCREEN_HALF_WIDTH, DISPLAY.VSCREEN_HALF_HEIGHT + 40, 0.5, 0.5
	End Method
	
	Method Update:Void()
		If MOUSE.Hit(MOUSE_LEFT)
			APP.fadeScreen.Start(50, True)
			APP.nextScreen = myGameScreen
		End
		
		If KeyHit(KEY_ESCAPE)
			APP.fadeScreen.Start(50, True)
			APP.nextScreen = APP.exitScreen
		End
	End Method
End

Class TGameScreen Extends TScreen

	
	Method New()
		name = "Game"
	End Method
	
	Method Start:Void()
		
		APP.fadeScreen.Start(50, False)
	End Method
	
	Method Render:Void()
		Cls
		DrawText "GAME SCREEN!", DISPLAY.VSCREEN_HALF_WIDTH, DISPLAY.VSCREEN_HALF_HEIGHT, 0.5, 0.5
		
		'FPS.Draw(0,0)
	End Method
	
	Method Update:Void()
		If KeyHit(KEY_ESCAPE)
			APP.fadeScreen.Start(50, True)
			APP.nextScreen = myTitleScreen
		End
		
	End Method
	
	Method PostFadeOut:Void()		
		Super.PostFadeOut()
	End Method
End Class









